# 1.打印1-50之间能被3整除的数字
n = 1
while n <= 50:
    if n % 3 == 0:
        print(n)
    n += 1
print("------------------------")
# 2.打印1-10之间数字的累加和
n = 1
sum = 0
while n <= 10:
    sum +=n
    n += 1
print("累加和：", sum)
print("------------------------")
# 去超市买东西，价格和数量，允许买多件商品计算所有商品的总额
total = 0
while True:
    price = float(input("请输入商品价格："))
    number = int(input("请输入商品数量："))
    total += price * number
    answer = input('当前商品总额：%.2f,是否继续添加商品(exit退出)：' % total)
    if answer == 'exit':
        break
print("商品总额：%.2f" % total)

